package b4.scene.town.building
{
	import b4.model.config.*;
	import b4.model.town.*;
	
	import flash.utils.getDefinitionByName;
	
	public class BuildingFactory
	{
		public function BuildingFactory()
		{
			//普通建筑
			var building:Building;
			//内政厅
			var homeOffice:HomeOffice;
			//马厩
			var horseStable:HorseStable;
			//靶场
			var targetRange:TargetRange;
			//擂台
			var arena:Arena;
			//池塘
			var lake:Lake;
			//矿场
			var goldMine:GoldMine;
			//学院
			var academy:Academy;
			//仓库
			var warehouse:Warehouse;
			//兵营
			var barracks:Barracks;
			//铁匠铺
			var blachSmith:BlachSmith;
			//伐木场
			var loggingCamp:LoggingCamp;
			//民房
			var farmHouse:FarmHouse;
			//女娲图腾
			var nvWaToten:NvWaToten;
			//炼妖炉
			var refiningKettle:RefiningKettle;
			//祭坛
			var alter:Alter;
			//箭楼
			var arrowTower:ArrowTower;
			//兽栏
			var corral:Corral;
			//辟邪塔
			var biXieTower:BiXieTower;
			//夔牛钟
			var kuiBell:KuiBell;
			//五行阵
			var fiveElementsArray:FiveElementsArray;
		}

		public static function createBuilding(buildingModel:BuildingModel):Building
		{
			//荣誉堂
			var buildingConfig:Object = GameConfig.basicConfig.buildingConfigs[buildingModel.buildingIndex];
			var objClassName:String = buildingConfig.className == "" ? "Building" : buildingConfig.className;
			var ObjClass:Class = getDefinitionByName("b4.scene.town.building." + objClassName) as Class;
			return new ObjClass(buildingModel);
		}
	}
}